function plot_CI(ttime, s, std_coeff, gdebt, debt2, upper, ylimit, s_cy)

    y1 = s;
    y2 = s + 2 * std_coeff;
    y3 = s - 2 * std_coeff;

    % plot the area
    y = [y3' (y2' - y3')];
    ha = area(ttime, y); hold on;
    set(ha(1), 'FaceColor', 'none') 
    set(ha, 'LineStyle', 'none')

    % plot the line edges
    hb = plot(ttime, y3, 'LineWidth', 1); hold on;
    hc = plot(ttime, y2, 'LineWidth', 1); hold on;

    % plot the point estimates
    hd = plot(ttime, y1, 'LineWidth', 3); hold on;
    % set the line and area colors
    set(ha(2), 'FaceColor', [0.7 0.7 0.7]);
    set(hb, 'Color', [0.9 0.9 0.9]);
    set(hc, 'Color', [0.9 0.9 0.9]);
    set(hd, 'Color', 'r');

    y1 = s;
    y2 = s + 1 * std_coeff;
    y3 = s - 1 * std_coeff;

    % plot the area
    y = [y3' (y2' - y3')];
    ha = area(ttime, y); hold on;
    set(ha(1), 'FaceColor', 'none') 
    set(ha, 'LineStyle', 'none')

    % plot the line edges
    hb = plot(ttime, y3, 'LineWidth', 1); hold on;
    hc = plot(ttime, y2, 'LineWidth', 1); hold on;

    % plot the point estimates
    hd = plot(ttime, y1, 'LineWidth', 3); hold on;
    % set the line and area colors
    set(ha(2), 'FaceColor', [0.5 0.5 0.5]);
    set(hb, 'Color', [0.9 0.9 0.9]);
    set(hc, 'Color', [0.9 0.9 0.9]);
    set(hd, 'Color', 'red');

    hg = plot(ttime, gdebt(1:end), 'Color', 'green', 'LineStyle', '-.', 'LineWidth', 3); hold on;
    hg2 = plot(ttime, debt2(1:end), 'Color', 'blue', 'LineWidth', 3); hold on;
    hu = plot(ttime, upper * ones(1, size(ttime, 2)), 'Color', 'black', 'LineWidth', 2); hold on;

    %%%% numbers from van Riel (2018) Table 7.4
    debt1828 = gdebt(12) * (760.1 / (760.1 + 837.0) * 0.57 + 837.0 / (760.1 + 837.0) * 0.019);

    hs = scatter(1828, debt1828, 40, "magenta", 'filled');
    axis([min(ttime) max(ttime) (-1) * ylimit(1) ylimit(2)])

    hleglines = [hd(1) hg(1) hg2(1) hu(1) hs(1)];
    legend(hleglines, 'PV(Surplus)/GDP, rp^Y=3%', 'Debt/GDP (Book Value)', 'Debt/GDP (Estimated Market Value)', 'PV(Surplus)/GDP at z=0', '1828 Debt/GDP (Market Value)', 'Location', 'Northeast')

    xlabel('Year')
    ylabel('PV(Surplus)/GDP')
    set(gca, 'Layer', 'top', 'FontSize', 9)
    set(gca, 'FontName', 'Times New Roman')

    grid
